# string 模块
# 字符串是否以某个字符开头
s1 = 'hello world'
print(s1.startswith('hello'))   # true
print(s1.startswith('he'))      # true
print(s1.startswith('world'))   # False
# 字符串是否以某个字符结尾
print(s1.endswith('world'))     # true
print(s1.endswith('ld'))        # true
print(s1.endswith('hello'))     # false
# 字符串是否包含某个字符
print('hello' in s1)            # true

s2 = 'python'
# 判断字符是否都是大写
print(s2.isupper())     # false 
# 判断字符是否都是小写
print(s2.islower())     # true
s3 = 'Python'
# 字母都转大写
print(s3.upper())
# 字母都转小写
print(s3.lower())

s4 = '  python  '
print('s4:', s4, '--end')
# 去除左侧空格
print('s4:', s4.lstrip(), '--end')
# 去除右端的空格
print('s4:', s4.rstrip(), '--end')
# 两端都去除空格
print('s4:', s4.strip(), '--end')

name = 'aaa.bbb.ccc.ddd.eee'
# 切割字符串，指定切割字符.
nlist = name.split('.')
print(nlist)
print(nlist[0], nlist[1], nlist[3])
# 列表拼接为字符串，指定连接符-
print('-'.join(nlist))

# test
text = '  Python is a High-level, interped, general-purpose programming langeage.  '
text1 = text.strip()
text2 = text1.lower()
print('high-level' in text2)

print('high-level' in text.strip().lower())